<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
 <script type="text/javascript">
$(function(){
	//初始化表单验证
	$("#addForm").validate({
		rules:{			
			tel: {isTelOrMobile: true},
			aphone: {isTelOrMobile: true},
			dixian: {isFloatGteZeroLtOne:true}
		},
		messages:{				
			title: {required: "请输入分公司名称"},
			shortName:{required: "请输入分公司简称"},	
			//BranchId:{required: "请输入关联分公司的Id"},
			address:{required: "请输入分公司具体地址"}, 
			tel: {required: "请输入座机或手机号码"},
			aname:{required: "请输入法人姓名"}, 
			aphone:{required: "请输入法人手机号码"}, 
			busthumb:{required: "请添加分公司营业执照"}
		},
		submitHandler:function(form){
			$(form).ajaxSubmit({
				success:function(data){
					switch(data.flag){
						case 2:
							Kit.alert("分公司名称不能大于30个字");return;
						case 3:
							Kit.alert("分公司名已经存在");return;
						case 5:
							Kit.alert("分公司简称不能大于10个字");return;
						case 8:
							Kit.alert("地址不能大于100个字");return;
						case 9:
							Kit.alert("选择主营范围");return;
						case 10:
							Kit.alert("请输入座机或手机号码");return;
						case 11:
							Kit.alert("请输入座机或手机号码");return;	
						case 12:
							Kit.alert("请输入座机或手机号码");return;
						case 14:
							Kit.alert("店内号码已存在");return;
						case 15:
							Kit.alert("该手机号码已注册，请更换手机号");return;
						/* case 14:
							Kit.alert("请输入关联分公司的Id");return; */
						case -1:
							Kit.alert("网络繁忙...，请重试");return;
						case 0:
							dataPaginator.loadPage(1);
							addDialog.close();
							return;
					}
				}
			});
		}
	});
});

var Picture;
function ToPicture(){
	Picture = Kit.dialog("编辑图片","${BASE_PATH}/dict/store/imageIndex/${stroeimagenum}",{closable:true,size:"size-wide"}).open();
}

</script> 
<form id="addForm" action="${BASE_PATH}/dict/store/doAdd" method="post" class="form-horizontal" enctype="multipart/form-data">
	<span style="margin-left:10px; color:red;">(*)</span><span  style="margin-right:10px; ">标记的为必填项</span>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>分公司名称</label>
	    <div class="col-sm-10">
        	<input type="text" name="title"  class="form-control" placeholder="分公司名称" required="required" maxlength="15">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>分公司简称</label>
	    <div class="col-sm-10">
        	<input type="text" id="titleld" name="shortName"  class="form-control" placeholder="请输入分公司简称" required >
	    </div>
	</div>
	<div style="display: none;">
		<div class="form-group">
		    <label class="col-sm-2 control-label">同步Id</label>
		    <div class="col-sm-10">
	        	<input type="text" id="BranchId" name="BranchId"  class="form-control" placeholder="请输入与第三方同步的Id" value="0"  maxlength="30">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">抵现比例</label>
		    <div class="col-sm-10">
	        	<input type="text" id="dixian" name="dixian"  class="form-control" value="0"  placeholder="请输入抵现比例0~1之间小数，如：0.01"   maxlength="5">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label">抵现积分类型</label>
		    <div class="col-sm-10">
				<select id="selectpoint" name="selectpoint" class="selectpicker form-control" data-width="210">
					<option value="1" selected="selected">积分</option>
					<option value="2">抵扣券</option>
					<option value="3">惠券</option>
				</select>
			</div>			
		</div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>所在城市</label>
	    <div class="col-sm-10">
			<select id="state" class="selectpicker form-control " name="cityid"  data-width="210">
				
				 <c:forEach items="${list}" var="city">					
					<option value="${city.id }" name="cityid">${city.name }</option>							
				</c:forEach>						
			</select>
		</div>			
	</div>	
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>主营范围</label>
	    <div class="col-sm-10">
        	 <ul class="iCheckList">
	    		<li><input type="radio" class="iCheck" name="scope" value="1" checked="checked">&nbsp;常规</li>
	    		<li><input type="radio" class="iCheck" name="scope" value="2" >&nbsp;团购</li>
		    </ul>
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>地理位置</label>
	    <div class="col-sm-10">
        	<input type="text" id="" name="address" value="" class="form-control" placeholder="请输入地理位置" required maxlength="50">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>店内联系方式</label>
	    <div class="col-sm-10">
        	<input type="text" name="tel" value="" class="form-control" placeholder="请输入店内联系方式如：0371-1738675" required maxlength="20">
	    </div>
	</div>
		<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>营业执照号</label>
	    <div class="col-sm-10">
        	<input type="text" name="busLicense" value="" class="form-control" placeholder="营业执照注册号/社会统一信用代码" required maxlength="20">
	    </div>
	</div>
	<!-- <div class="form-group">
		<label class="col-sm-2 control-label">地图定位</label>
		<div class="col-sm-10">
			<input type="file" id="thumb" name="storethumb" style="height:30px;width:80%" accept="image/jpg" title="选择文件">
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success">建议640px*300px,大小60K以内，支持JPEG、PNG格式</span></div>
	</div> -->
	<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>分公司营业执照</label>
		<div class="col-sm-10">
			<input type="file" id="thumb" name="busthumb" accept="image/jpg,image/png" title="选择文件" required>
		</div>
		<div class="col-lg-offset-2 p-t-5 col-lg-9"><span class="text-success">建议640px*300px,大小60K以内，支持JPEG、PNG格式</span></div>
	</div>
		<div class="form-group">
		<label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>图片管理</label>
		<div class="col-sm-10">
	   <a class="btn btn-primary" onclick="ToPicture();">轮播图片</a>
		</div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>法人姓名</label>
	    <div class="col-sm-10">
        	<input type="text" name="aname" value="" class="form-control" placeholder="请输入联系人名称" required maxlength="20">
	    </div>
	</div>
	<div class="form-group">
	    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>法人手机号</label>
	    <div class="col-sm-10">
        	<input type="tel" name="aphone" value="" class="form-control" placeholder="请输入电话" required maxlength="11">
	    </div>
	    <div class="col-lg-offset-2 p-t-5 col-lg-9"><span style="margin-right:10px; color:red;">*</span><span class="text-success">法人手机号默认为H5前端登录账号，默认密码为手机号后6位</span></div>
	</div>
	<!-- ------------------------------------- -->
	<div style="display: none;">
	    <p style=" margin-left: 100px "> 请提供一个本店其他人员的联系方式</p>
		<div class="form-group">
		    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>姓名</label>
		    <div class="col-sm-10">
	        	<input type="text" name="bname" value="" class="form-control" placeholder="请输入联系人姓名" maxlength="20">
		    </div>
		</div>
		<div class="form-group">
		    <label class="col-sm-2 control-label"><span style="margin-right:10px; color:red;">*</span>联系方式</label>
		    <div class="col-sm-10">
	        	<input type="text" name="bphone" value="" class="form-control" placeholder="请输入电话" maxlength="13">
		    </div>
		</div>
	</div>
	<!-- ----------------------------------------- -->
	<div class="row">
		<div class="col-lg-6"><button class="btn btn-primary col-sm-3 pull-right" type="submit" autocomplete="off">提交</button></div>
		<div class="col-lg-6"><button class="btn btn-default col-sm-3 pull-left" type="button" onclick="javascript:addDialog.close();" autocomplete="off">取消</button></div>
	</div>
	<input type="hidden" name="stroeimagenum" value="${stroeimagenum}">
</form>